import React, { Component } from 'react'
import Myevents from "../utils/events"
class appclass extends Component {
    state = {
        name:""
    }
    btnclick() {
        this.props.fn("我是子组件中的数")
    }
    componentDidMount() {
        Myevents.addListener("zhao",this.fn)
    }
    fn = (data)=>{
        console.log(data);
        this.setState({
            name:data
        })

    }
  render() {
    console.log(this.props);
    return (
      <div>
          {
              this.props.bbb && this.props.bbb.length?   this.props.bbb.map((item,index)=>{
                  return <div key={index}>{item.tit}</div>
              }):""
            
          }
          <button onClick={this.btnclick.bind(this)}>点击</button>
      </div>
    )
  }
}

export default appclass